<?php

namespace Biz\model;
use Doraemon\pockets\datebase\BaseDbModel;

class ShopAuthority extends BaseDbModel
{
    const _CONFIG_FILE_ = 'db_shop';

    const _CONFIG_SELECT_ = 'db_shop_info';

    const _DATABASE_ = 'shop_info';

    const _TABLE_NAME = 'shop_authority';

    public static function insertShopAuthority($data, $shop_id)
    {
        self::insert([
            'shop_id' => $shop_id,
            'authority_status' => json_encode($data)
        ]);

        return self::id();
    }

    public static function getAuthorityRow($shop_id, $column = '*')
    {
         return self::get($column, ['shop_id' => $shop_id]);
    }

    public static function updateAuthorityRow($data, $shop_id)
    {
        return self::update(['authority_status' => json_encode($data)], ['shop_id' => $shop_id]);
    }
}
